const express = require('express');
const router = express.Router();
const employeeController = require('../controllers/employeeController');
const authMiddleware = require('../middlewares/auth');
const adminMiddleware = require('../middlewares/admin');

// 所有员工路由需要认证
router.use(authMiddleware);

// 获取所有员工
router.get('/', employeeController.getAllEmployees);

// 创建新员工 (仅管理员)
router.post('/', adminMiddleware, employeeController.createEmployee);

// 获取单个员工
router.get('/:id', employeeController.getEmployee);

// 更新员工信息 (仅管理员)
router.put('/:id', adminMiddleware, employeeController.updateEmployee);

// 更新员工状态 (仅管理员)
router.put('/:id/status', adminMiddleware, employeeController.updateEmployeeStatus);

// 删除员工 (仅管理员)
router.delete('/:id', adminMiddleware, employeeController.deleteEmployee);

module.exports = router;